<template>
  <div>
    <div class="block trans">
      <!-- 标题 -->
      <title-box title="个人日常技术总结"></title-box>
    </div>
    <div class="block trans" style="margin:10px 0">
      <el-row>
        <el-col :span="12" v-for="item in AllArticle" :key="item.id" :offset="item.id > 0 ? 2 : 0" 
          style="margin: 10px" class="contanincard">
          <el-card :body-style="{ padding: '10px' }" class="contanincard">
          <el-image
          style="width: 400px; height: 200px"
          :src="item.img"
          fit=cover></el-image>
            <div style="padding: 10px;">
              <span>{{item.title}}</span>
              <div class="bottom clearfix">
                <p class="time" style="margin: 10px 0">{{item.descript}}</p>
                <time class="time" style="margin: 10px 0">{{item.time}}</time>
              </div>
              <el-button type="text" class="button" @click="GotoArticleDetail(item.id)">查看详情</el-button>
            </div>
          </el-card>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import TitleBox from '../TitleBox/titleBox.vue'
  export default {
    props:['AllArticle'],
    components:{
      TitleBox
    },
    methods:{
           // 去文章详情
      GotoArticleDetail(id){
        this.$router.push({name:'detail',params: {id:id}})
      }
    }
  }
</script>

<style lang="scss" scoped>
ul {
  margin-top: 15px;
}
li {
  margin:20px 0 30px 0;
  cursor:pointer;
}
.title {
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 600;
}
.content {
  display: flex;
  .image {
    overflow: hidden;
    border-radius: 5px;
    cursor:pointer;
    width: 200px;
    height: 130px;
    img {
      width: 100%;
      height: 100%;
      transition: all 0.4s;
    }
    img:hover {
      transform: scale(1.3);
    }
  }
  .describe {
    margin-left: 10px;
    flex:5;
    position: relative;
    overflow: hidden;
    height: 150px;
    .tag {
      margin: 5px 0;
      .el-tag {
        margin-right: 10px;
      }
    }

     p {
        display: block;
        font-size: 14px;
        color: #666;
        // 文字溢出隐藏
        overflow: hidden;
        display: -webkit-box;
        text-overflow: ellipsis;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        line-height: 26px;
      }
    .describe-bottom {
      position: absolute;
      bottom: 0;
      width: 100%;
      line-height: 28px;
      i {
        margin-right: 5px;
      }
      span {
        margin: 0 10px;
        font-size: 14px;
        color: rgb(107, 107, 107);
      }
      .author {
        margin-left: 0;
      }
     
      .el-button {
        float: right;
      }
    }
  }
}
.contanincard{
  width: 400px;
}
.trans{
  background: rgba(255, 255, 255, .6);
  box-shadow: 3px 3px 6px 3px rgba(0, 0, 0, .3);
}
</style>